{{ $posts_len := len (where (where .Site.RegularPages "Type" "post") ".Params.notonhomepage" nil) }}
{{ if gt $posts_len 0 }}
<section id="posts" class="home-section">
    <div class="container">
        <div class="row">
            
            <!-- Section heading -->
            <div class="col-xs-12 col-md-4 section-heading">
                <h1><a href="{{ $.Site.BaseURL }}/post/{{if .Site.Params.uglyURLs}}index.html{{end}}"> {{ with .Site.Params.posts.title }}{{ . | markdownify }}{{ end }}</a></h1>
                {{ with .Site.Params.posts.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
            </div>
            
            <!-- Posts -->
            <div class="col-xs-12 col-md-8">
                {{ range first .Site.Params.posts.count (sort (where .Site.RegularPages "Type" "post") ".Params.sort_position") }}
                    {{ partial "index/single_post" .}}
                {{ end }}
            </div>
            
        </div>

        <!-- Link to all posts -->
        <div>
            {{ if gt $posts_len .Site.Params.posts.count }}
                <p class="view-all">
                    <a href="{{ .Site.BaseURL }}/post/{{if .Site.Params.uglyURLs}}index.html{{end}}">
                        {{ with .Site.Params.posts.str_all }}{{ . | markdownify }}{{ end }}
                        <i class="fa fa-angle-double-right"></i>
                    </a>
                </p>
            {{ end }}
        </div>
        
    </div>
</section>
{{ end }}